<template>
  <div>
    <el-row class="tac">
      <el-col :span="12">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-submenu
            :index="1 + 1"
            v-for="(i, index) in menulist"
            :key="index"
          >
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>{{ i.name }}</span>
            </template>
            <el-menu-item-group>
              <el-menu-item
              :index="i.id"
                v-for="(s, index) in i['son']"
                :key="index"
                @click="kk(s.id)"
                >{{ s.name }}</el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menulist: [],
    };
  },
  mounted() {
    this.getkind()
    
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    getkind(){
      this.axios.get("/getkind").then(res =>{
        this.menulist = res.data.data
      })
    },
    kk(id){
      alert(id)
    }
  },
};
</script>

<style>
</style>